package com.zxy.designpattern.singletonpattern;

/**
 * 以静态类的形式，实现单例.
 * 
 * 并没有延迟初始化.
 * 
 * Created by zxybird on 2018/2/5.
 */
public class StaticSingleton1 {

  private static StaticSingleton1 instance = new StaticSingleton1();

  private StaticSingleton1() {
  }

  public static StaticSingleton1 getInstance() {
    return instance;
  }

  public void say() {
    System.out.println("Hello");
  }

  public static void main(String[] args) {
    StaticSingleton1.getInstance().say();
  }

}
